﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public struct Octree
{
    private SceneTree        m_SceneTree;
    private TreeNode         m_MainNode;
    private DivisionTreeType m_DivisionTreeType;

    
    public TreeNode MainNode => this.m_MainNode;
    
    public void InitOctree(SceneTree tree, Bounds treebounds, IEnumerable<SceneObject> boundses)
    {
        this.m_SceneTree = tree;
        if (this.m_MainNode == null)
        {
            this.m_MainNode = new TreeNode(tree.DivTreeType);
            this.m_MainNode.SetBounds(treebounds);
            this.m_MainNode.DivTree();
        }

        if (boundses != null)
        {
            IEnumerator<SceneObject> iterator = boundses.GetEnumerator();
            while (iterator.MoveNext())
            {
                SceneObject sobject = iterator.Current;
                if (this.m_MainNode.Append(sobject))
                {
                
                }
            }
            iterator.Dispose();
        }
    }
}